//
//  Config.swift
//  Chatup
//
//  Created by op on 2023/11/2.
//

import Foundation


struct ConfigRoleModel{
    let name:String
    let id:Int
    
    init(name: String, id: Int) {
        self.name = name
        self.id = id
    }
}

class Config{
    static let shared = Config()
    
    var list:[ConfigRoleModel] = []
    
    
    func toModel(dic:[String:Any]){
        self.list.removeAll()
        if let list = dic["data"] as? [[String:Any]]{
            list.forEach { dic in
                if let name = dic["role_name"] as? String,let id =  dic["id"] as? Int{
                    let model = ConfigRoleModel(name: name, id: id)
                    self.list.append(model)
                }

            }
        }
    }
}
